home *** CD-ROM | disk | FTP | other *** search
/ New Perspectives on Computer Concepts / New Perspectives on Computer Concepts.iso / np2010c / L02a.swf / scripts / LSuperClass.as < prev    next >
Text File  |  2007-12-30  |  4KB  |  168 lines

  1. _global.LToolBox = function()
  2. {
  3.    this.interaction_id = undefined;
  4.    this.interaction_type = undefined;
  5.    this.correct_response = undefined;
  6.    this.student_response = undefined;
  7.    this.result = undefined;
  8.    this.feedback = undefined;
  9.    this.numOfTries = 1;
  10.    this.feedback_list = undefined;
  11.    this.tracking = undefined;
  12.    this.weighting = undefined;
  13.    this.objective_id = undefined;
  14.    this.latency = undefined;
  15.    this.navigation = undefined;
  16.    this.buttonLabels = new Array();
  17. };
  18. _global.LToolBox.prototype = new Object();
  19. LToolBox.prototype.setTextField = function(fieldName, val)
  20. {
  21.    this.assets_path[fieldName].text = val;
  22. };
  23. LToolBox.prototype.setComponentLabel = function(UIComponent, val)
  24. {
  25.    this.assets_path[UIComponent].label = val;
  26.    this.assets_path[UIComponent].redraw(true);
  27. };
  28. LToolBox.prototype.setComponentListener = function(UIComponent, val)
  29. {
  30.    this.assets_path[UIComponent].clickHandler = val;
  31. };
  32. LToolBox.prototype.setComponentState = function(UIComponent, val)
  33. {
  34.    this.assets_path[UIComponent].enabled = val;
  35. };
  36. LToolBox.prototype.getComponentLabel = function(UIComponent)
  37. {
  38.    return this.assets_path[UIComponent].label;
  39. };
  40. LToolBox.prototype.setRadioGroupName = function(UIComponent, val)
  41. {
  42.    this.assets_path[UIComponent].groupName = val;
  43. };
  44. LToolBox.prototype.initControlButton = function(eventHandler)
  45. {
  46.    if(this.feedback == true)
  47.    {
  48.       this.label_state = this.buttonLabels[1];
  49.       if(this.navigation == 2)
  50.       {
  51.          this.navigation = 1;
  52.       }
  53.    }
  54.    else if(this.tracking == true)
  55.    {
  56.       this.label_state = this.buttonLabels[2];
  57.    }
  58.    else if(this.navigation != 0)
  59.    {
  60.       this.label_state = this.buttonLabels[3];
  61.       if(this.navigation == 2)
  62.       {
  63.          this.navigation = 1;
  64.       }
  65.    }
  66.    else
  67.    {
  68.       this.label_state = this.buttonLabels[0];
  69.    }
  70.    this.setComponentLabel(this.Assets.ControlButton,this.label_state);
  71.    this.setComponentState(this.Assets.ControlButton,false);
  72.    this.setComponentListener(this.Assets.ControlButton,eventHandler);
  73. };
  74. LToolBox.prototype.setFeedback = function(val)
  75. {
  76.    if(this.feedback == true)
  77.    {
  78.       var _loc2_ = this.Assets.FeedbackField;
  79.       var _loc4_ = this.Assets.ControlButton;
  80.       if(val == 0)
  81.       {
  82.          this.setTextField(_loc2_,this.feedback_list[0]);
  83.       }
  84.       else if(val == 1)
  85.       {
  86.          var _loc5_ = this.getComponentLabel(_loc4_);
  87.          this.setTextField(_loc2_,this.feedback_list[3]);
  88.       }
  89.       else if(val == 2)
  90.       {
  91.          this.setTextField(_loc2_,this.feedback_list[1]);
  92.       }
  93.       else if(val == 3)
  94.       {
  95.          if(this.numOfTries > 1)
  96.          {
  97.             this.setTextField(_loc2_,this.feedback_list[4]);
  98.          }
  99.          else
  100.          {
  101.             this.setTextField(_loc2_,this.feedback_list[2]);
  102.          }
  103.       }
  104.       else if(val == 4)
  105.       {
  106.          this.setTextField(_loc2_,this.feedback_list[4]);
  107.       }
  108.    }
  109. };
  110. LToolBox.prototype.setNavigation = function()
  111. {
  112.    if(this.navigation == 0)
  113.    {
  114.       this.setComponentState(this.Assets.ControlButton,false);
  115.    }
  116.    else if(this.navigation == 1)
  117.    {
  118.       if(!this.buttonFlag || this.buttonFlag == false)
  119.       {
  120.          this.setComponentLabel(this.Assets.ControlButton,this.buttonLabels[3]);
  121.          this.buttonFlag = true;
  122.       }
  123.       else if(this.navAction == false)
  124.       {
  125.          if(!this.navLabel)
  126.          {
  127.             this.assets_path.nextFrame();
  128.          }
  129.          else
  130.          {
  131.             this.assets_path.gotoAndStop(this.navLabel);
  132.          }
  133.       }
  134.       else if(this.navAction == true)
  135.       {
  136.          if(!this.navLabel)
  137.          {
  138.             this.assets_path.gotoAndPlay(this._currentframe + 1);
  139.          }
  140.          else
  141.          {
  142.             this.assets_path.gotoAndPlay(this.navLabel);
  143.          }
  144.       }
  145.    }
  146.    else if(this.navigation == 2)
  147.    {
  148.       this.assets_path.nextFrame();
  149.    }
  150. };
  151. LToolBox.prototype.submitScore = function()
  152. {
  153.    if(this.weighting <= 0 || this.weighting == undefined)
  154.    {
  155.       this.weighting = 1;
  156.    }
  157.    var _loc2_ = undefined;
  158.    if(this.result == "C")
  159.    {
  160.       _loc2_ = this.weighting;
  161.    }
  162.    else if(this.result == "W")
  163.    {
  164.       _loc2_ = -1 * this.weighting;
  165.    }
  166.    QuizTrack.countScore(_loc2_);
  167. };
  168.